In [1]:
import numpy as np
from matplotlib import pyplot as plt
from __future__ import division
from spacetime.CA_Simulators.CAs import *
from spacetime.Local_Measures.Local_Complexity import *
%matplotlib inline
In [2]:
def wildcard_tiling(x,t):
'''
Returns spacetime field of dimension (x,t) sampled from 0-wildcard tiling language.
'''
field = np.zeros((t,x), dtype=int)
for i in xrange(t):
for j in xrange(x):
if i % 2 == 0 and j % 2 == 0:
field[i,j] = np.random.choice([0,1])
elif i % 2 == 1 and j % 2 == 1:
field[i,j] = np.random.choice([0,1])
return field
In [3]:
def random_field(x,t):
'''
Returns binary random field (each site drawn from uniform distribution over {0,1}) of dimension (x,t).
'''
field = np.random.choice((0,1), (t,x))
return field
In [6]:
print random_field(10,5)
In [4]:
field = random_field(600, 600)
In [5]:
random_states = epsilon_field(field)
random_states.estimate_states(2,2,1)
random_states.filter_data()
In [6]:
print random_states.number_of_states()
In [6]:
print random_states.nonunifilar_transitions()
In [7]:
print len(random_states.all_transitions())
In [8]:
for trans in random_states.transitions_from_state(2):
print trans
In [9]:
for trans in random_states.transitions_from_state(1):
print trans
In [14]:
t = random_states.all_transitions()[20]
print t[1]
print t[1][2:]
In [ ]:
In [ ]:
In [15]:
for trans in random_states.transitions_to_state(1):
print trans
In [ ]:
In [11]:
state_overlay_diagram(field, random_states.get_causal_field(), t_max = 50, x_max = 50)
In [13]:
for state in random_states.causal_states():
print state.plc_configs()
In [16]:
for state in random_states.causal_states():
print state.morph()
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [20]:
t_trans = random_states.all_transitions(zipped = False)[1]
print np.unique(t_trans)
In [22]:
print np.log(8)/np.log(2)
In [5]:
print random_states.entropy_rate('forward')
In [6]:
print random_states.entropy_rate('right')
In [7]:
print random_states.entropy_rate('left')
In [23]:
random_states = epsilon_field(random_field(600,600))
random_states.estimate_states(3,2,1)
random_states.filter_data()
In [24]:
t_trans = random_states.all_transitions(zipped = False)[1]
print np.unique(t_trans)
In [26]:
print np.log(32)/np.log(2)
print np.log(8)/np.log(2)
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [16]:
wildcard_field = wildcard_tiling(1000,1000)
In [17]:
wildcard_states = epsilon_field(wildcard_field)
wildcard_states.estimate_states(3,3,1)
wildcard_states.filter_data()
In [18]:
print wildcard_states.number_of_states()
In [ ]: